package com.unipay.spring.service;

import com.unipay.spring.service.impl.BookService;
import com.unipay.spring.service.impl.CheckoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @BelongsProject: SSM
 * @Author: cmy
 * @CreateTime: 2023-01-18  16:14
 * @Description: TODO
 */
@Service
public class CheckoutServiceImpl implements CheckoutService {

    @Autowired
    private BookService bookService;

    @Override
    @Transactional
    public void checkout(Integer bookId, Integer userId) {
        // 一次购买多本书
        bookService.buyBook(1, 1);
        bookService.buyBook(1, 1);
    }
}
